Merge branch 'features/ttn' of http://git.toontownstride.com/toontownstride/src into features/ttn

This commit is contained in:
John Cote 2015-07-23 16:30:06 -04:00
commit 02e452b594

View file

@ -12,8 +12,8 @@ from CatalogMouldingItem import CatalogMouldingItem, getAllMouldings
from CatalogWainscotingItem import CatalogWainscotingItem, getAllWainscotings from CatalogWainscotingItem import CatalogWainscotingItem, getAllWainscotings
from CatalogWindowItem import CatalogWindowItem from CatalogWindowItem import CatalogWindowItem
from CatalogPoleItem import nextAvailablePole, getAllPoles from CatalogPoleItem import nextAvailablePole, getAllPoles
from CatalogTankItem import nextAvailableTank, getAllTanks
from CatalogPetTrickItem import CatalogPetTrickItem, getAllPetTricks from CatalogPetTrickItem import CatalogPetTrickItem, getAllPetTricks
from CatalogTankItem import nextAvailableTank, getAllTanks
from CatalogGardenItem import CatalogGardenItem from CatalogGardenItem import CatalogGardenItem
from CatalogToonStatueItem import CatalogToonStatueItem from CatalogToonStatueItem import CatalogToonStatueItem
from CatalogRentalItem import CatalogRentalItem from CatalogRentalItem import CatalogRentalItem
@ -26,7 +26,7 @@ from toontown.toonbase import ToontownGlobals
import types import types
import random import random
import time import time
from panda3d.core import * from pandac.PandaModules import *
MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 111, 115, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 211, 215), MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 111, 115, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 211, 215),
300: getAllClothes(301, 302, 303, 304, 305, 308, 401, 403, 404, 405, 407, 451, 452, 453), 300: getAllClothes(301, 302, 303, 304, 305, 308, 401, 403, 404, 405, 407, 451, 452, 453),
2000: getChatRange(0, 1999), 2000: getChatRange(0, 1999),
@ -41,25 +41,20 @@ MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109
2921: getChatRange(12050, 12099), 2921: getChatRange(12050, 12099),
2930: getChatRange(13000, 13099), 2930: getChatRange(13000, 13099),
2940: getChatRange(14000, 14099), 2940: getChatRange(14000, 14099),
3000: getWallpapers(1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100), 3000: getWallpapers(1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100),
3010: getWallpapers(2200, 2300, 2400, 2500, 2600, 2700, 2800), 3010: getWallpapers(2200, 2300, 2400, 2500, 2600, 2700, 2800),
3020: getWallpapers(2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600), 3020: getWallpapers(2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600),
3030: getWallpapers(3700, 3800, 3900), 3030: getWallpapers(3700, 3800, 3900),
3500: getAllWainscotings(1000, 1010), 3500: getAllWainscotings(1000, 1010),
3510: getAllWainscotings(1020), 3510: getAllWainscotings(1020),
3520: getAllWainscotings(1030), 3520: getAllWainscotings(1030),
3530: getAllWainscotings(1040), 3530: getAllWainscotings(1040),
4000: getFloorings(1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100), 4000: getFloorings(1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100),
4010: getFloorings(1110, 1120, 1130), 4010: getFloorings(1110, 1120, 1130),
4020: getFloorings(1140, 1150, 1160, 1170, 1180, 1190), 4020: getFloorings(1140, 1150, 1160, 1170, 1180, 1190),
4500: getAllMouldings(1000, 1010), 4500: getAllMouldings(1000, 1010),
4510: getAllMouldings(1020, 1030, 1040), 4510: getAllMouldings(1020, 1030, 1040),
4520: getAllMouldings(1070), 4520: getAllMouldings(1070),
5000: getAllPetTricks()} 5000: getAllPetTricks()}
MetaItemChatKeysSold = (2000, MetaItemChatKeysSold = (2000,
2010, 2010,
@ -401,7 +396,29 @@ MonthlySchedule = ((7,
15, 15,
8, 8,
15, 15,
2010,
2010,
((4, 2940),)), ((4, 2940),)),
(9,
1,
9,
30,
(CatalogGardenItem(135, 1),)),
(1,
1,
1,
31,
(CatalogGardenItem(135, 1),)),
(4,
1,
4,
30,
(CatalogGardenItem(135, 1),)),
(6,
1,
6,
30,
(CatalogGardenItem(135, 1),)),
(6, (6,
26, 26,
7, 7,
@ -460,16 +477,22 @@ MonthlySchedule = ((7,
9, 9,
7, 7,
15, 15,
2010,
2010,
(CatalogClothingItem(1751, 0),)), (CatalogClothingItem(1751, 0),)),
(6, (6,
14, 14,
7, 7,
15, 15,
2010,
2010,
(CatalogClothingItem(1754, 0), CatalogClothingItem(1755, 0), CatalogClothingItem(1756, 0))), (CatalogClothingItem(1754, 0), CatalogClothingItem(1755, 0), CatalogClothingItem(1756, 0))),
(7, (7,
21, 21,
8, 8,
17, 17,
2010,
2010,
(CatalogClothingItem(1749, 0), (CatalogClothingItem(1749, 0),
CatalogClothingItem(1750, 0), CatalogClothingItem(1750, 0),
CatalogClothingItem(1757, 0), CatalogClothingItem(1757, 0),
@ -478,6 +501,8 @@ MonthlySchedule = ((7,
25, 25,
9, 9,
21, 21,
2010,
2010,
(CatalogClothingItem(1763, 0),)), (CatalogClothingItem(1763, 0),)),
(6, (6,
5, 5,
@ -488,43 +513,48 @@ MonthlySchedule = ((7,
1, 1,
12, 12,
31, 31,
( (CatalogGardenItem(100, 1),
CatalogGardenItem(100, 1),
CatalogGardenItem(101, 1), CatalogGardenItem(101, 1),
CatalogGardenItem(103, 1), CatalogGardenItem(103, 1),
CatalogGardenItem(104, 1), CatalogGardenItem(104, 1),
CatalogToonStatueItem(105, endPoseIndex=108), CatalogToonStatueItem(105, endPoseIndex=108),
CatalogRentalItem(1, 2880, 1000), CatalogRentalItem(1, 2880, 1000),
CatalogRentalItem(2, 2890, 1000),
CatalogGardenStarterItem(), CatalogGardenStarterItem(),
CatalogFurnitureItem(1530), CatalogFurnitureItem(1530),
CatalogFurnitureItem(1531), CatalogFurnitureItem(1531),
CatalogFurnitureItem(1532), CatalogFurnitureItem(1532),
CatalogNametagItem(15),
CatalogNametagItem(16),
CatalogNametagItem(17),
CatalogClothingItem(1608, 0, True),
CatalogClothingItem(1605, 0, True), CatalogClothingItem(1605, 0, True),
CatalogClothingItem(1602, 0, True), CatalogClothingItem(1602, 0, True),
CatalogClothingItem(1607, 0, True),
CatalogClothingItem(1604, 0, True), CatalogClothingItem(1604, 0, True),
CatalogClothingItem(1601, 0, True), CatalogClothingItem(1601, 0, True),
CatalogClothingItem(1606, 0, True),
CatalogClothingItem(1603, 0, True), CatalogClothingItem(1603, 0, True),
CatalogClothingItem(1600, 0, True), CatalogClothingItem(1600, 0, True),
CatalogEmoteItem(25, True),
CatalogEmoteItem(26, True),
CatalogEmoteItem(20, True), CatalogEmoteItem(20, True),
CatalogEmoteItem(21, True), CatalogEmoteItem(21, True),
CatalogEmoteItem(22, True), CatalogEmoteItem(22, True),
CatalogEmoteItem(23, True), CatalogEmoteItem(23, True),
CatalogEmoteItem(24, True), CatalogEmoteItem(24, True))),
CatalogEmoteItem(25, True),
CatalogEmoteItem(26, True),
CatalogNametagItem(15, True),
CatalogNametagItem(16, True),
CatalogNametagItem(17, True))),
(5, (5,
26, 26,
6, 6,
30, 30,
2013,
2013,
(CatalogAccessoryItem(175),)), (CatalogAccessoryItem(175),)),
(8, (8,
27, 27,
9, 9,
5, 5,
2013,
2013,
((3, 2900), ((3, 2900),
CatalogChatItem(10003), CatalogChatItem(10003),
CatalogClothingItem(1001, 0), CatalogClothingItem(1001, 0),
@ -574,6 +604,8 @@ MonthlySchedule = ((7,
3, 3,
9, 9,
12, 12,
2013,
2013,
((3, 2910), ((3, 2910),
CatalogFurnitureItem(680), CatalogFurnitureItem(680),
CatalogFurnitureItem(681), CatalogFurnitureItem(681),
@ -608,6 +640,8 @@ MonthlySchedule = ((7,
20, 20,
9, 9,
19, 19,
2013,
2013,
(CatalogAccessoryItem(101), (CatalogAccessoryItem(101),
CatalogAccessoryItem(103), CatalogAccessoryItem(103),
CatalogAccessoryItem(117), CatalogAccessoryItem(117),
@ -830,9 +864,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1000), CatalogFurnitureItem(1000),
CatalogClothingItem(117, 0), CatalogClothingItem(117, 0),
CatalogClothingItem(217, 0), CatalogClothingItem(217, 0),
nextAvailableCloset, nextAvailableCloset),
nextAvailableBank,
nextAvailableTank),
(100, (100,
(5, 2000), (5, 2000),
CatalogFurnitureItem(1430), CatalogFurnitureItem(1430),
@ -1353,7 +1385,7 @@ WeeklySchedule = ((100,
Sale(CatalogClothingItem(116, 0), CatalogClothingItem(216, 0), CatalogClothingItem(408, 0), CatalogClothingItem(117, 0), CatalogClothingItem(217, 0), CatalogClothingItem(409, 0), CatalogClothingItem(118, 0), CatalogClothingItem(218, 0), CatalogClothingItem(410, 0), CatalogClothingItem(119, 0), CatalogClothingItem(219, 0), CatalogClothingItem(120, 0), CatalogClothingItem(220, 0), CatalogClothingItem(121, 0), CatalogClothingItem(221, 0), CatalogClothingItem(222, 0), CatalogClothingItem(123, 0), CatalogClothingItem(224, 0), CatalogClothingItem(411, 0), CatalogClothingItem(311, 0), CatalogClothingItem(310, 0)), Sale(CatalogClothingItem(116, 0), CatalogClothingItem(216, 0), CatalogClothingItem(408, 0), CatalogClothingItem(117, 0), CatalogClothingItem(217, 0), CatalogClothingItem(409, 0), CatalogClothingItem(118, 0), CatalogClothingItem(218, 0), CatalogClothingItem(410, 0), CatalogClothingItem(119, 0), CatalogClothingItem(219, 0), CatalogClothingItem(120, 0), CatalogClothingItem(220, 0), CatalogClothingItem(121, 0), CatalogClothingItem(221, 0), CatalogClothingItem(222, 0), CatalogClothingItem(123, 0), CatalogClothingItem(224, 0), CatalogClothingItem(411, 0), CatalogClothingItem(311, 0), CatalogClothingItem(310, 0)),
Sale(CatalogWindowItem(40), CatalogWindowItem(70), CatalogWindowItem(50), CatalogWindowItem(60), CatalogWindowItem(80), CatalogWindowItem(100), CatalogWindowItem(90), CatalogWindowItem(110)), Sale(CatalogWindowItem(40), CatalogWindowItem(70), CatalogWindowItem(50), CatalogWindowItem(60), CatalogWindowItem(80), CatalogWindowItem(100), CatalogWindowItem(90), CatalogWindowItem(110)),
Sale(CatalogEmoteItem(5), CatalogEmoteItem(9), CatalogEmoteItem(13), CatalogEmoteItem(11), CatalogEmoteItem(6), CatalogEmoteItem(8), CatalogNametagItem(10)), Sale(CatalogEmoteItem(5), CatalogEmoteItem(9), CatalogEmoteItem(13), CatalogEmoteItem(11), CatalogEmoteItem(6), CatalogEmoteItem(8), CatalogNametagItem(10)),
Sale(CatalogFurnitureItem(600), CatalogFurnitureItem(610), CatalogFurnitureItem(620), CatalogFurnitureItem(630), CatalogFurnitureItem(640), CatalogFurnitureItem(650), CatalogFurnitureItem(660), CatalogFurnitureItem(900), CatalogFurnitureItem(910), CatalogFurnitureItem(920), CatalogFurnitureItem(930), CatalogFurnitureItem(940), CatalogFurnitureItem(1000), CatalogFurnitureItem(1010), CatalogFurnitureItem(1020), CatalogFurnitureItem(1030), CatalogFurnitureItem(1400), CatalogFurnitureItem(1410), CatalogFurnitureItem(1420), CatalogFurnitureItem(1430), CatalogFurnitureItem(1440), CatalogFurnitureItem(1441), CatalogFurnitureItem(1442), CatalogFurnitureItem(1443), CatalogFurnitureItem(1500), CatalogFurnitureItem(1510), CatalogFurnitureItem(1520), CatalogFurnitureItem(1530), CatalogFurnitureItem(1531), CatalogFurnitureItem(1532), CatalogFurnitureItem(1600), CatalogFurnitureItem(1610), CatalogFurnitureItem(1620), CatalogFurnitureItem(1630), CatalogFurnitureItem(1640), CatalogFurnitureItem(1650), CatalogFurnitureItem(1660), CatalogFurnitureItem(1661), CatalogFurnitureItem(1710), CatalogFurnitureItem(1800), CatalogFurnitureItem(1810), CatalogFurnitureItem(1900), CatalogFurnitureItem(1910)), Sale(CatalogFurnitureItem(600), CatalogFurnitureItem(610), CatalogFurnitureItem(620), CatalogFurnitureItem(630), CatalogFurnitureItem(640), CatalogFurnitureItem(650), CatalogFurnitureItem(660), CatalogFurnitureItem(900), CatalogFurnitureItem(910), CatalogFurnitureItem(920), CatalogFurnitureItem(930), CatalogFurnitureItem(940), CatalogFurnitureItem(1000), CatalogFurnitureItem(1010), CatalogFurnitureItem(1020), CatalogFurnitureItem(1030), CatalogFurnitureItem(1400), CatalogFurnitureItem(1410), CatalogFurnitureItem(1420), CatalogFurnitureItem(1430), CatalogFurnitureItem(1440), CatalogFurnitureItem(1441), CatalogFurnitureItem(1442), CatalogFurnitureItem(1443), CatalogFurnitureItem(1500), CatalogFurnitureItem(1510), CatalogFurnitureItem(1520), CatalogFurnitureItem(1530), CatalogFurnitureItem(1600), CatalogFurnitureItem(1531), CatalogFurnitureItem(1532), CatalogFurnitureItem(1610), CatalogFurnitureItem(1620), CatalogFurnitureItem(1630), CatalogFurnitureItem(1640), CatalogFurnitureItem(1650), CatalogFurnitureItem(1660), CatalogFurnitureItem(1661), CatalogFurnitureItem(1710), CatalogFurnitureItem(1800), CatalogFurnitureItem(1810), CatalogFurnitureItem(1900), CatalogFurnitureItem(1910)),
(300, (300,
(1, 2020), (1, 2020),
(2, 2030), (2, 2030),
@ -1480,9 +1512,12 @@ class CatalogGenerator:
def __init__(self): def __init__(self):
self.__itemLists = {} self.__itemLists = {}
self.__releasedItemLists = {}
if config.GetBool('save-catalog-schedule', False): def getReleasedCatalogList(self, weekStart):
self.outputSchedule('catalog-schedule.txt') dayNumber = int(weekStart / (24 * 60))
itemLists = self.__getReleasedItemLists(dayNumber, weekStart)
return itemLists
def generateMonthlyCatalog(self, avatar, weekStart): def generateMonthlyCatalog(self, avatar, weekStart):
dayNumber = int(weekStart / (24 * 60)) dayNumber = int(weekStart / (24 * 60))
@ -1512,13 +1547,12 @@ class CatalogGenerator:
if nextAvailableCloset not in schedule: if nextAvailableCloset not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0) weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0)
if nextAvailableBank not in schedule: if nextAvailableBank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem=0) weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem = 0)
if nextAvailableTank not in schedule: if nextAvailableTank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem=0) weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem = 0)
if True: if time.time() < 1096617600.0:
def hasPetTrick(catalog): def hasPetTrick(catalog):
for item in catalog: for item in catalog:
@ -1528,6 +1562,7 @@ class CatalogGenerator:
return 0 return 0
if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog): if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog):
self.notify.debug('Artificially adding pet trick to catalog')
weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem) weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem)
self.notify.debug('Generated catalog: %s' % weeklyCatalog) self.notify.debug('Generated catalog: %s' % weeklyCatalog)
return weeklyCatalog return weeklyCatalog
@ -1557,12 +1592,45 @@ class CatalogGenerator:
return backCatalog return backCatalog
def __getReleasedItemLists(self, dayNumber, weekStart):
itemLists = self.__releasedItemLists.get(dayNumber)
if itemLists != None:
return itemLists
else:
self.__releasedItemLists.clear()
testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
year = nowtuple[0]
month = nowtuple[1]
day = nowtuple[2]
itemLists = []
for monthlyItems in MonthlySchedule:
startMM = monthlyItems[0]
startDD = monthlyItems[1]
endMM = monthlyItems[2]
endDD = monthlyItems[3]
if len(monthlyItems) == 7:
startYYYY = monthlyItems[4]
endYYYY = monthlyItems[5]
list = monthlyItems[6]
else:
startYYYY = 1969
endYYYY = year
list = monthlyItems[4]
pastStart = year > startYYYY or (year == startYYYY and (month > startMM or (month == startMM and day >= startDD)))
if pastStart:
itemLists.append(list)
self.__releasedItemLists[dayNumber] = itemLists
return itemLists
def __getMonthlyItemLists(self, dayNumber, weekStart): def __getMonthlyItemLists(self, dayNumber, weekStart):
itemLists = self.__itemLists.get(dayNumber) itemLists = self.__itemLists.get(dayNumber)
if itemLists != None: if itemLists != None:
return itemLists return itemLists
testDaysAhead = config.GetInt('test-server-holiday-days-ahead', 0) testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60) nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
year = nowtuple[0]
month = nowtuple[1] month = nowtuple[1]
day = nowtuple[2] day = nowtuple[2]
self.notify.debug('Generating seasonal itemLists for %s/%s.' % (month, day)) self.notify.debug('Generating seasonal itemLists for %s/%s.' % (month, day))
@ -1572,9 +1640,16 @@ class CatalogGenerator:
startDD = monthlyItems[1] startDD = monthlyItems[1]
endMM = monthlyItems[2] endMM = monthlyItems[2]
endDD = monthlyItems[3] endDD = monthlyItems[3]
list = monthlyItems[4] if len(monthlyItems) == 7:
pastStart = month > startMM or (month == startMM and day >= startDD) startYYYY = monthlyItems[4]
beforeEnd = month < endMM or (month == endMM and day <= endDD) endYYYY = monthlyItems[5]
list = monthlyItems[6]
else:
startYYYY = 1969
endYYYY = year
list = monthlyItems[4]
pastStart = year >= startYYYY and (month > startMM or (month == startMM and day >= startDD))
beforeEnd = year <= endYYYY and (month < endMM or (month == endMM and day <= endDD))
if endMM < startMM: if endMM < startMM:
if pastStart or beforeEnd: if pastStart or beforeEnd:
itemLists.append(list) itemLists.append(list)
@ -1705,33 +1780,31 @@ class CatalogGenerator:
def __recordSchedule(self, sched, weekCode, schedule): def __recordSchedule(self, sched, weekCode, schedule):
if isinstance(schedule, Sale): if isinstance(schedule, Sale):
schedule = schedule.args schedule = schedule.args
try: for item in schedule:
for item in list(schedule): if callable(item):
if callable(item): if item == nextAvailablePole:
if item == nextAvailablePole: item = getAllPoles()
item = getAllPoles() elif item == nextAvailableCloset:
elif item == nextAvailableCloset: item = getAllClosets()
item = getAllClosets() elif item == nextAvailableBank:
elif item == nextAvailableBank: item = getAllBanks()
item = getAllBanks() elif item == nextAvailableTank:
elif item == nextAvailableTank: item == getAllTanks()
item = getAllTanks() elif item == get50ItemCloset:
elif item == get50ItemCloset: item = getMaxClosets()
item = getMaxClosets() else:
else: self.notify.warning("Don't know how to interpret function " % repr(name))
self.notify.warning("Don't know how to interpret function " % repr(name)) item = None
item = None elif isinstance(item, types.TupleType):
elif isinstance(item, types.TupleType): item = item[1]
item = item[1] if isinstance(item, types.IntType):
if isinstance(item, types.IntType): item = MetaItems[item]
item = MetaItems[item] if isinstance(item, CatalogItem.CatalogItem):
if isinstance(item, CatalogItem.CatalogItem): self.__recordScheduleItem(sched, weekCode, None, item)
self.__recordScheduleItem(sched, weekCode, None, item) elif item != None:
elif item != None: for i in item:
for i in item: self.__recordScheduleItem(sched, None, weekCode, i)
self.__recordScheduleItem(sched, None, weekCode, i)
except:
print 'Wrong: %s' % schedule
return return
def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item): def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item):